import pandas as pd
from fillpat import *
from openpyxl import Workbook
oto_loc = {
    'C3' :'公司名称',
    'M3' :'请款部门',
    'W3' :'填单日期',
    'F11':'小写合计',
    'M11':'大写合计',
    'W11':'附件数量',
    'E12':'是转工资',
    'G12':'否转工资',
    'K12':'原借支',
    'O12':'现报销',
    'W12':'剩余交回',
    'K13':'收款账号',
    'U13':'开户银行'
}
mtm_loc = {
    '6:10':'行范围',
    'B':'事由或品名',
    'I':'单位',
    'J':'数量',
    'L':'单价',
    'M':'币种',
    'N':'金额',
    'W':'备注'
}

rec = pd.read_excel('.\datas\费用报销记录.xlsx')

adata = rec.loc[0,['公司名称','请款部门','填单日期','小写合计','大写合计','附件数量','是转工资','否转工资','原借支','现报销','剩余交回',
'收款账号','开户银行']]

sheet = Exsheet()
sheet.read_pattern('.\datas\费用报销单.xlsx')

wb = Workbook()
ws = wb.active

for i in range(1,3):
    sheet.Id=i
    sheet.fill_blank(oto_loc,adata,mtm_loc,rec)

    sheet.put_in_sheet(ws)

wb.save('testom.xlsx')   

for idx in sheet.block.heights.index:
    print(f'{idx}: {sheet.block.heights[idx]}')
print('done')
